﻿using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace IndentationSplitter.Tests
{
    [TestClass]
    public class IndentationParserTests
    {
        [TestMethod, TestCategory("UnitTest")]
        public void CanParseTree()
        {
            const string indentedText = @"item1
    item2
        item3
        item4
    item5
    item6
        item7
            item8
item9";

            var items = new IndentedTree(indentedText).RootItems.ToArray();

            Assert.AreEqual(2, items.Length);

            Assert.AreEqual("item1", items[0].Value);
            Assert.AreEqual("item2", items[0].Children[0].Value);
            Assert.AreEqual("item4", items[0].Children[0].Children[1].Value);
        }
    }
}
